from django.db import models
from luffyapi.utils.models import BaseModel
# Create your models here.
class BannerInfo(BaseModel):
    '''
    轮播图
    '''
    #upload_to 存储子目录,真实存放地址会使用配置中的MEDIE_ROOT+upload_to
    image = models.ImageField(upload_to='banner',verbose_name='轮播图',null=True,blank=True)
    name = models.CharField(max_length=150,verbose_name='轮播图名称')
    note = models.CharField(max_length=150,verbose_name='备注信息')
    link = models.CharField(max_length=150,verbose_name='轮播图广告地址')



    class Meta:
        db_table = 'ly_banner'
        verbose_name = '轮播图'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name


class NavInfo(BaseModel):
    '''导航'''
    NAV_POSITION = (
        (0,'top'),
        (1,'footer')
    )
    name = models.CharField(max_length=50,verbose_name='导航名称')
    link = models.CharField(max_length=250,verbose_name='导航地址')
    opt = models.SmallIntegerField(choices=NAV_POSITION,default=0,verbose_name='位置')

    class Meta:
        db_table = 'ly_nav'
        verbose_name = '导航'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name
